package com.miyu.system.dao.system;

import com.alibaba.fastjson2.JSONArray;
import com.miyu.common.utils.basedao.BaseDao;
import com.miyu.system.pojo.system.SysUser;
import org.springframework.stereotype.Repository;

/**
 * 系统用户刀
 *
 * @author longm
 * @date 2022/10/04
 */
@Repository
public interface SysUserDao extends BaseDao<SysUser,String> {

    /**
     * 查询系统用户
     *
     * @param info 信息
     * @return {@link JSONArray}
     */
    public default JSONArray querySysUser(String info){
        JSONArray array = new JSONArray();
        StringBuffer sql = new StringBuffer();
        sql.append("  select * from sys_user  ");
        sql.append(" where 1=1 ");
        if(info != null){
            sql.append(" and (user_name like '%"+info+"%' ").append(" or user_code like '%"+info+"%' ").append(")");
        }
        array = this.queryJSONArrayBySql(sql.toString());

        return array;
    }
}
